package com.hdu.pyl.service.basic;

import com.hdu.pyl.mappper.TagsMapper;
import com.hdu.pyl.model.ResultEnum;
import com.hdu.pyl.pojo.NewsTags;
import com.hdu.pyl.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class NewsTagsServiceImpl implements NewsTagsService {
    @Autowired
    private TagsMapper tagsMapper;
    @Override
    @Transactional
    public NewsTags findByNewsId(int newsId){
        NewsTags newsTags =tagsMapper.findByNewsId(newsId);
        if (newsTags ==null){
            return null;
        }else {
            return newsTags;
        }
    }
    @Override
    @Transactional
    public NewsTags insertTag(NewsTags newsTags){
        if (newsTags ==null|| newsTags.getNewsId()==null){
            return null;
        }else {
            tagsMapper.insertTag(newsTags);
            return newsTags;
        }
    }
}
